<?php
	/* Template Name: Blog Style 1 Left Sidebar */
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
	<meta charset="utf-8" />
	<title><?php bloginfo('name'); ?> <?php wp_title(' | ', true, 'left'); ?></title>
	<?php if(get_option('reedwan_feedburner_url')): ?>
		<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php echo get_option('reedwan_feedburner_url'); ?>" /> 
	<?php endif; ?>
	<?php if(get_option('reedwan_favicon')): ?>
		<link rel="shortcut icon" href="<?php echo get_option('reedwan_favicon'); ?>" />
	<?php endif; ?>
	<meta name="description" content="">
	<meta name="author" content="">
	
	<!-- Mobile Specific Metas -->
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> 
	
	<script type="application/x-javascript">
		addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false);
		function hideURLbar(){
			window.scrollTo(0,1);
		}
	</script>
	<?php
	wp_localize_script('ReedwanStyle', 'ReedwanVars', array(
	'ajaxUrl' => admin_url('admin-ajax.php'),
	));
	?>
	<?php if(is_singular()) { wp_enqueue_script('comment-reply'); } ?>
	<?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>

	<div id="fb-root"></div>
	<script>(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0];  if (d.getElementById(id)) return;  js = d.createElement(s); js.id = id;  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";  fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script>
	
<?php $theme_layout = get_option('reedwan_themelayout','true'); ?>
<?php if(get_option('reedwan_show_ticker') == 'true' || get_option('reedwan_show_top_menu') == 'true'):?>
<?php if ($theme_layout=="full"){ echo '<div class="top-wrap">'; }?>
	<div class="top row">
		
		<?php if(get_option('reedwan_show_ticker') == 'true'):?>
		<div class="grid_6">
			<?php get_template_part('includes/spotlight'); ?>
		</div>
		<?php endif; ?>
		
		<?php if(get_option('reedwan_show_top_menu') == 'true'):?>
		<div class="grid_6 top-nav-wrapper">
				<?php wp_nav_menu( array( 'container' =>false, 'theme_location' => 'topNav', 'menu_class' => 'topNav' ) ); ?>
		</div>
		<div class="grid_12 mobile-nav-wrapper">
			<?php dropdown_menu( array('dropdown_title' => __('Select a Page','unicorn'), 'indent_string' => '- ', 'indent_after' => '', 'theme_location'=>'topNav') ); ?>	
		</div>
		<?php endif; ?>
	</div>
<?php if ($theme_layout=="full"){ echo '</div>'; }?>
	<div class="arrow-top"><div class="arrow-down black"></div></div>
<?php endif; ?>

<!-- Header -->
<?php if ($theme_layout=="full"){ echo '<div class="header-wrap">'; }?>
	<div class="header row">
		<!-- Header Logo-->
		<div class="header-logo">
			<?php
				if(get_option('reedwan_logo')) {
					$logo = get_option('reedwan_logo');
				}
				else
				{
					$logo = get_template_directory_uri() . '/images/header-logo.png';	
				}								
			?>
			<a href='<?php echo home_url(); ?>'><img src="<?php echo $logo; ?>" alt="<?php bloginfo('name'); ?>" /></a>
		</div>
		<?php if ( is_active_sidebar( 'header-banner' ) ) : ?>
			<!-- Begin Header Adds -->
			<div class="header-adds">
				<?php dynamic_sidebar( 'header-banner' ); ?>
			</div>
		<?php endif; ?>
	</div>
<?php if ($theme_layout=="full"){ echo '</div>'; }?>


<!-- Navigation -->
<?php if ($theme_layout=="full"){ echo '<div class="navigation-wrap">'; }?>
	<div class="navigation row">
		<!-- Main Navigation -->
		<div class="grid_12 main-nav-wrapper">
			<?php wp_nav_menu( array( 'container' =>false, 'theme_location' => 'mainNav', 'menu_class' => 'sf-menu' ) ); ?>
		</div>	
		<div class="grid_12 mobile-nav-wrapper">
			<?php dropdown_menu( array('dropdown_title' => __('Select a Page','unicorn'), 'indent_string' => '- ', 'indent_after' => '', 'theme_location'=>'mainNav') ); ?>	
		</div>
	</div>
<?php if ($theme_layout=="full"){ echo '</div>'; }?>


<!-- Content -->
<?php if ($theme_layout=="full"){ echo '<div class="content-wrap">'; }?>
<div class="content row">

<?php get_template_part('includes/full-slider'); ?>
<?php $sidebar_position = get_option('reedwan_sidebar_position', 'true');?>
<?php if($sidebar_position=='left'):  ?>
<!-- Left Sidebar -->
<div class="grid_4 sidebar">
	<?php get_sidebar();?>
</div> 
<?php endif; ?>

<div class="grid_8 magazine">
				<?php if(get_option('reedwan_sliderlayout') == 'Small'): ?>
				<?php
				$featured_posts = new WP_Query(array('post_type' => 'post','showposts' => get_option('reedwan_slider_item'),'tag' => get_option('reedwan_slider_tags')
				));
				?>
				<!-- Small Slider -->
				
					<div class="flexslider small">
	   					 <ul class="slides">
						 	<?php while($featured_posts->have_posts()): $featured_posts->the_post(); ?>
	    					<li>
								<a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'>
								<?php if (has_post_thumbnail()) { 
									the_post_thumbnail('small-slider'); 
								} else {
									echo('<img src="'.get_template_directory_uri().'/images/thumbnails/no-image-small-slider.png" alt="no image" />');	
								} ?>
								</a>
								<?php if(get_option('reedwan_caption') == 'true'):?>
								<div class="flex-caption">
									<div class="caption-time">
										<span class="day"><?php echo get_the_date('d');  ?></span>
										<span class="year"><?php echo get_the_date('Y');  ?></span>
										<span class="month"><?php echo get_the_date('F');  ?></span>
									</div>
									<h3><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'><?php the_title(); ?></a></h3>
									<p><?php echo string_limit_words(get_the_excerpt(), 35); ?></p>
								</div>
								<?php endif; ?>
							</li>
							<?php endwhile; wp_reset_query();?>
	  				  	</ul>
	  				</div>
					<div class="clear"></div>
			<?php endif; ?>
			
			<?php
			if(is_category()): 
				$category_ID = get_query_var('cat');
				$category_featured_enabled = get_tax_meta($category_ID,'reedwan_featured_slider');	
				$number_featured_slider = get_tax_meta($category_ID,'reedwan_number_featured_slider');
				$tag_featured_slider = get_tax_meta($category_ID,'reedwan_tag_featured_slider');
				
				if($category_featured_enabled == 'on'): 
					if($tag_featured_slider == false): 
						$featured_posts = new WP_Query(array('post_type' =>'post','cat' => $category_ID,'showposts' =>$number_featured_slider));
					else:
						$featured_posts = new WP_Query(array('post_type' =>'post','tag' => $tag_featured_slider,'showposts' =>$number_featured_slider));
					endif;
				?>
				<!-- Category Slider -->
					<div class="flexslider small">
	   					 <ul class="slides">
						 	<?php while($featured_posts->have_posts()): $featured_posts->the_post(); ?>
	    					<li>
								<a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'>
								<?php if (has_post_thumbnail()) { 
									the_post_thumbnail('small-slider'); 
								} else {
									echo('<img src="'.get_template_directory_uri().'/images/thumbnails/no-image-small-slider.png" alt="no image" />');	
								} ?>
								</a>
								<?php if(get_option('reedwan_caption') == 'true'):?>
								<div class="flex-caption">
									<div class="caption-time">
										<span class="day"><?php echo get_the_date('d');  ?></span>
										<span class="year"><?php echo get_the_date('Y');  ?></span>
										<span class="month"><?php echo get_the_date('F');  ?></span>
									</div>
									<h3><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'><?php the_title(); ?></a></h3>
									<p><?php echo string_limit_words(get_the_excerpt(), 35); ?></p>
								</div>
								<?php endif; ?>
							</li>
							<?php endwhile; wp_reset_query();?>
	  				  	</ul>
	  				</div>
					<div class="clear"></div>
			<?php endif; endif; ?>
				
	<?php if ( is_active_sidebar( 'magazine' ) ) : ?>
		<?php dynamic_sidebar( 'magazine' ); ?>
	<?php else: ?>
		<div class="widget" style="text-align:center;"><h1><?php _e('Put the megazine widget here...', 'unicorn');?></h1></div>
	<?php endif; ?>
</div>

<?php if($sidebar_position=='right'):  ?>
<!-- Right Sidebar -->
<div class="grid_4 sidebar">
	<?php get_sidebar();?>
</div>
<?php endif; ?>

</div>
<?php 
$theme_layout = get_option('reedwan_themelayout'); 
$footer_column = get_option('reedwan_footercolumn');
?>

<?php if ($theme_layout=="full"){ echo '</div>'; }?>
<?php if(get_option('reedwan_show_footernav') == 'true'):?>
	<?php if ($theme_layout=="full"):?><div class="footer-nav-wrap"><?php endif; ?>	
		<div class="footer-nav row">
			<?php wp_nav_menu( array( 'container' =>false,'depth' => 1, 'theme_location' => 'bottomNav', 'menu_class' => 'bottomNav' ) ); ?>
		</div>
	<?php if ($theme_layout=="full"):?></div><?php endif; ?>	
<?php endif; ?>	


<?php if ($footer_column!="none"){ ?>
<!-- Footer Widget -->
<?php if ($theme_layout=="full"){ echo '<div class="footer-widget-wrap">'; }?>	
	<div class="footer-widget-block row">
	<?php
		if($footer_column == "footer1"){
			get_template_part('includes/footer1');	
		}
		if($footer_column == "footer2"){ 
			get_template_part('includes/footer2');
		}
		if($footer_column == "footer3"){ 
			get_template_part('includes/footer3');
		}
		if($footer_column == "footer4"){ 
			get_template_part('includes/footer4');
		}
	?>
	</div>
<?php if ($theme_layout=="full"){ echo '</div>'; }?>
<?php } ?>		
<!-- Footer -->
<?php if (get_option('reedwan_footer_text') || get_option('reedwan_show_social')=='true'):?>
<?php if ($theme_layout=="full"){ echo '<div class="footer-wrap" >'; }?>	
	<div class="footer footrow">
		<?php if (get_option('reedwan_footer_text')):?>
		<!-- Credits -->
		<div class="credits">
			<?php echo stripslashes (get_option('reedwan_footer_text')); ?>
		</div>
		<?php endif; ?>
		<?php if (get_option('reedwan_show_social')=='true'):?>
		<!-- Social -->
		<div class="social-footer-wrap">
			<div class="social-footer">
				<?php get_template_part('includes/social'); ?>
			</div>
		</div>
		<?php endif; ?>
	</div>
<?php if ($theme_layout=="full"){ echo '</div>'; }?>	
<?php endif; ?>	
	
	<?php
	if(get_option('reedwan_code_allow_google') == 'true') {
		echo stripslashes (get_option('reedwan_analytics'));
	}
	?>
	<?php wp_footer(); ?>
</body>
</html>

		
	
			
			
			
			
				
				
	
		
			